package org.xxpay.pay.channel.atoa;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.xxpay.common.unify.AbstractPaymentConfig;
@Component
@Data
@ToString
@NoArgsConstructor
public class AtoaPayConfig extends AbstractPaymentConfig {
    public static final String CHANNEL_NAME = "atoa";
    public static final String CHANNEL_NAME_8000_B2B =CHANNEL_NAME+ "_b2b";//网银
    public static final String CHANNEL_NAME_8001_QUICK =CHANNEL_NAME+ "_quick";//快捷
    public static final String CHANNEL_NAME_8002_WX_SCAN =CHANNEL_NAME+ "_wxpay_scan";//微信扫码
    public static final String CHANNEL_NAME_8003_WX_H5 =CHANNEL_NAME+ "_wxpay";//微信H5
    public static final String CHANNEL_NAME_8004_WX_JSAPI = CHANNEL_NAME+"_wxpay_jsapi";//微信公众号
    public static final String CHANNEL_NAME_8005_WX_XCX = CHANNEL_NAME+"_wxpay_xcx";//微信小程序
    public static final String CHANNEL_NAME_8006_ALI_QR = CHANNEL_NAME+"_ali_qr";//支付宝扫码
    public static final String CHANNEL_NAME_8007_ALI_H5 = CHANNEL_NAME+"_ali_wap";//支付宝H5

    public static final String CHANNEL_NAME_8014_UNION_QR = CHANNEL_NAME+"_union_qr";//银联扫码
    public static final String CHANNEL_NAME_8011_JD_QR = CHANNEL_NAME+"_jd_qr";//京东扫码
    public static final String RETURN_VALUE_SUCCESS = "2";
    public static final String RETURN_VALUE_SUCCESS2 = "3";

    public static final String REQ_PAY_URL_FIXX = "/api/pay/create_order";
    public static final String REQ_PAY_QUERY_URL_FIXX = "/api/pay/query_order";
    public static final String REQ_TRANS_URL_FIXX = "/api/agentpay/apply";
    public static final String REQ_TRANS_QUERY_URL_FIXX = "/api/agentpay/query_order";
    public static final String REQ_TRANS_BALANCE_URL_FIXX = "/api/agentpay/query_balance";
    public static final String RESPONSE_RESULT_FAIL = "fail";       // 返回上游失败
    public static final String RESPONSE_RESULT_OK = "success"; // 返回上游成功
    AtoaPayConfig(String payParam){
        Assert.notNull(payParam, "init sft config error");
        JSONObject object = JSON.parseObject(payParam);
        setAppId(object.getString("appId"));
        setMchId(object.getString("mchId"));
        setPayMode(object.getString("payType"));
        setPrivateKey(object.getString("privatekey"));
        setRequestUrl(object.getString("requestUrl"));
        setExtInfo(object.getString("tl"));
    }
}
